<%@page pageEncoding="UTF-8" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%String path  = request.getContextPath(); %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<base target="_self"/>
<title>用户信息修改页面</title>
</head>
<jsp:include page="../common/init.jsp"></jsp:include>
<script type="text/javascript" src="<%=path%>/dwr/interface/RyjbxxService.js"></script>
<script type="text/javascript" src="<%=path%>/dwr/engine.js"></script>
<script type="text/javascript" src="<%=path%>/dwr/util.js"></script>
<%
 response.setHeader("Pragma", "No-cache");
 response.setHeader("Cache-Control", "no-cache");
 response.setDateHeader("Expires", 0);
%>
<% if(request.getAttribute("result")!=null && request.getAttribute("result").toString().equals("OK")) {%>
<script language="javascript">
//向父窗口返回的值
window.returnValue = "这是子窗口返回来的值,需要刷新父窗口";
window.close();
</script>
<% } %>
<script type="text/javascript">
//验证用户名
function validateYhm(ajaxFlag)
{
	var checkId="appsysDlyh.yhm";
	var checkValue=document.getElementById("appsysDlyh.yhm").value;
	var errorDivId="yhmDiv";
	var errorImgId="yhmImg";
	if(checkNullValue(checkValue))
	{
		showMenuDelegate(checkId,errorDivId,errorImgId,"用户名不能为空!");
		return false;
	}
	else if (checkValue.length>50)
	{
		showMenuDelegate(checkId,errorDivId,errorImgId,"用户名长度不能超过50个字!");
		return false;
	} 
	else if (ajaxFlag=='b')
	{
		var flag =false;
		var bhs = "${yhbhs}";
		var joinValue=checkValue+":"+checkValue;
		   DWREngine.setAsync(false); 		     
			 RyjbxxService.checkYhm(joinValue,function(callBack){
			         if(callBack==true){
			            flag =true;        
			         }                   
			       }
			);		
			if(flag!=undefined){ 			
				if(flag==false)
				{
					showMenuDelegate(checkId,errorDivId,errorImgId,"该用户名已被用,请重新填写!");
					return false;
				}
				else
				{
					return true;
				}
			}else{
			  return false;
			}
	}
	else
	{
		hiddenErrorImg(errorImgId);
		return true;
	}
}
//验证人员姓名
function validateRyxm()
{
	var checkId="ryxm";
	var checkValue=document.getElementById("ryxm").value;
	var errorDivId="ryxmDiv";
	var errorImgId="ryxmImg";
	if(checkNullValue(checkValue))
	{
		showMenuDelegate(checkId,errorDivId,errorImgId,"姓名不能为空，请选择姓名!");
		return false;
	}
	else
	{
		hiddenErrorImg(errorImgId);
		return true;
	}
}
//选择人员姓名
function selRyxx()
{
    var action="<%=request.getContextPath() %>/webmanager/qxgl/selRy.jsp?tempid=" 
    + Math.random();
    win = window.showModalDialog(action,null,'dialogHeight=450px;dialogWidth=710px;status=no;scroll=no;help=no');
    callback(win);
	//openWindow=window.open(action, "newwin", "height=450, width=700,toolbar=no,top=100,left=100,scrollbars=no,menubar=no");
}
function callback(rValue){
	if(rValue!=null)
	{
		ryxx=rValue;
		document.forms[0].ryxm.value=ryxx[0];
		document.getElementById("rybh").value=ryxx[1];
	}
}
//提交
function doSubmit()
{
	if(validateYhm('b')&&validateRyxm())
	{
		document.forms[0].action="qxgl/reworkDlyh.do";
		document.forms[0].submit();
	}

}
//页面关闭
function winClose()
{
	window.returnValue = "ok";
	window.close();
}
//表单reset
function formReset()
{
	document.forms[0].reset();
}
//提示信息
function showMessage(){
	var message="<%=request.getAttribute("info")%>";
	if(message != "null" && message != ""){
		document.getElementById('errorDivCreateWzbm').innerHTML='提示信息:<span style="font-size:12px;color:#ff0000">' + message + '</span>';
		document.getElementById('errorDivCreateWzbm').style.display="inline";
		document.getElementById('errorDivCreateWzbm').focus();
	}
}
//生成功能按钮	
mpmenu1=new mMenu('','winClose()','script','<%=request.getContextPath() %>/images/img_ht_wz_44.gif','62','24','0','100','2');
//mpmenu2=new mMenu('','#','self','<%=request.getContextPath() %>/images/img_ht_wz_38.gif','62','24','0','20','0');
//mpmenu3=new mMenu('','#','self','<%=request.getContextPath() %>/images/img_ht_wz_42.gif','62','24','0','20','0');
</script>
<body onload="showMessage()">
<s:form action="">
<table cellspacing="0" cellpadding="0" class="main_tab1" onclick="javascript: mouseClick('errorDivCreateWzbm');">
    <tr>
        <td rowspan="4" class="main_tab1_td8">&nbsp;</td>
        <td class="main_tab1_td1"><img src="<%=request.getContextPath() %>/images/img_ht_wz_28.gif" alt="left" /></td>
        <td class="main_tab1_td2">
		<div id="location">用户信息修改页面</div>
		<div id="funbut">
			<SCRIPT>document.write(mwritetodocument());</SCRIPT>
		</div>
		</td>
        <td class="main_tab1_td1"><img src="<%=request.getContextPath() %>/images/img_ht_wz_32.gif" alt="right" /></td>
    </tr>
    <tr>
        <td colspan="3" class="main_tab1_td3">
		<div id="mainbg">
		<div class="jiange10"></div>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="main_tab3">
				<tr valign="bottom" height="30">
					<td height="25" colspan="2" align="left" valign="bottom"
						class="r_tab_c_4">
						<div id="errorDivCreateWzbm"></div>
						<s:hidden name="appsysDlyh.id"></s:hidden>
						<s:hidden name="appsysDlyh.yhbh"></s:hidden>
						<s:hidden name="appsysDlyh.mima"></s:hidden>
						<s:hidden name="appsysDlyh.scbz"></s:hidden>
						<s:hidden name="appsysDlyh.cjr"></s:hidden>
						<s:hidden name="appsysDlyh.cjrq"></s:hidden>
						<s:hidden name="appsysDlyh.mmwt"></s:hidden>
						<s:hidden name="appsysDlyh.mmts"></s:hidden>
						<s:hidden name="appsysDlyh.rybh" id="rybh"></s:hidden>
						<s:hidden name="appsysDlyh.yhlx"></s:hidden>
						<s:hidden name="appsysDlyh.fssm"></s:hidden>
					</td>
				</tr>
				<tr valign="bottom" align="center" height="30">
					<th align="right">
						用户名：
					</th>
					<td align="left" >
					<s:textfield id="appsysDlyh.yhm" name="appsysDlyh.yhm" size="25" maxLength="30"
						theme="simple" onclick="javascript: mouseClick('yhmDiv')" 
								onfocus="this.style.borderColor='#68A6F5'" onblur="validateYhm('b');" cssClass="inp_02"></s:textfield>
						 &nbsp;
					<font color="#ff0000">*</font>
				<img src="" id="yhmImg" style="display:none;"/>
				<div id="yhmDiv" style="background:#008080;display:none;cursor:default"/>
					</td>
				</tr>
				<tr valign="bottom" height="30">
					<th align="right">
						姓名：
					</th>
					<td >
					<input name="ryxm" id="ryxm" type="text" value="<s:property value="ryxm"/>" size="20" maxlength="30" disabled="disabled"  
					onclick="javascript: mouseClick('ryxmDiv')" 
					onfocus="this.style.borderColor='#68A6F5'" onblur="validateRyxm();" class="inp_02">
					&nbsp;<font color="#ff0000">*</font>
					<a href="javascript:void(0)" onfocus="this.blur()" >
					<img src="<%=request.getContextPath() %>/images/img_ht_wz_82.gif" border="0"  onclick="selRyxx();" >
		            </a>
							            &nbsp;
				<img src="" id="ryxmImg" style="display:none;"/>
				<div id="ryxmDiv" style="background:#008080;display:none;cursor:default"/>
					</td>
				</tr>
			</table>
<div class="butk">
<div class="btn_01">
<a href="#" onclick="doSubmit()">保&nbsp;存</a>
</div>
<div class="btn_01">
<a href="#" onclick="formReset()">清&nbsp;除</a>
</div>
</div>
</div>
</td>
    </tr>
    <tr>
        <td class="main_tab1_td4"><img src="<%=request.getContextPath() %>/images/img_ht_wz_65.gif" alt="left" /></td>
        <td class="main_tab1_td5"></td>
        <td class="main_tab1_td4"><img src="<%=request.getContextPath() %>/images/img_ht_wz_67.gif" alt="right" /></td>
    </tr>
    <tr>
        <td colspan="3" class="main_tab1_td7">&nbsp;</td>
    </tr>
</table>
<div id="Menu" style="background:#008080;display:none;cursor:default">
</div>
</s:form>
</body>
</html>
